package com.cian.entity.dto;

import com.cian.entity.CommodityInform;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
public class CommodityDTO {
    @ApiModelProperty(value = "商品的id")
    private Integer coId;

    @ApiModelProperty(value = "商品的名称")
    private String coName;

    @ApiModelProperty(value = "商品的图片地址")
    private String path;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "商品的图片创建时间")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "商品的图片更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "表示查询到的总数")
    private Integer count;

    @ApiModelProperty(value = "一页最大的数量")
    private Integer pageMaxNum;

    public CommodityDTO(){}

    public CommodityDTO(Integer count,Integer pageMaxNum, CommodityInform commodityInform){
        this.count = count;
        this.pageMaxNum = pageMaxNum;
        this.coId = commodityInform.getCoId();
        this.coName = commodityInform.getCoName();
        this.path = "/img/" + commodityInform.getCoFileName();
        this.createTime = commodityInform.getCreateTime();
        this.updateTime = commodityInform.getUpdateTime();
    }

}
